﻿<%@ Page Title="" Language="C#" MasterPageFile="~/TsSite.Master" AutoEventWireup="true" CodeBehind="GeographicalAreaList.aspx.cs" Inherits="TireService.Web.View.ResourceView.GeographicalAreaList" %>


<%@ Register Assembly="DevExpress.Web.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxCallback" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxPopupControl" TagPrefix="dx" %>
<%@ Register assembly="DevExpress.Web.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxPanel" tagprefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxRoundPanel" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v11.1.Export, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxGridView.Export" TagPrefix="dx" %>
<%@ Register assembly="DevExpress.Web.ASPxGridView.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dx" %>


<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <table cellpadding="0" cellspacing="2" border="0">
        <tr>
            <td>
                <img id="imgContainer" alt="" src="~/Images/Medium/cubes_yellow.png" runat="server" style="width: 32px; height: 32px" />
            </td>
            <td valign="middle">
                <h3><asp:Label ID="lblGeoAreaHeader" runat="server" Text="Geografiske planlægnings områder"></asp:Label></h3>
            </td>
        </tr>
    </table>
    <hr />

    <!-- Javascript of action dropdown list -->
    <script language="javascript" type="text/javascript">

        // Function that handles actions selected in dropdown list
        function ActionClicked() {

            // Get selected action from dropdownlist
            var id = ddlAction.GetValue();

            if (id != null && id != 0) {
                

            }
            else {
                alert('Ingen handling valgt');
            }
        }

    </script>          
                
    <table border="0" cellspacing="0" cellpadding="5" width="100%">
        <tr>
            <td style="width:150px">
                <dx:ASPxComboBox ID="ddlAction" ClientInstanceName="ddlAction" runat="server" Width="150px">
                    <Items>
                        <dx:ListEditItem Selected="true" Value="0" Text="-- Handling --" />
                    </Items>
                </dx:ASPxComboBox>
            </td>
            <td style="width:75px">
                <dx:ASPxButton ID="btnSubmitAction" runat="server" Text="Udfør" AutoPostBack="False" UseSubmitBehavior="False" Width="75px">
                    <ClientSideEvents Click="function(s, e) { ActionClicked(); }" />
                </dx:ASPxButton>
            </td>
            <td style="width:150px">
                <dx:ASPxComboBox ID="ddlExport" ClientInstanceName="ddlExport" runat="server" Width="150px">
                    <Items>
                        <dx:ListEditItem Selected="True" Value="0" Text="Export pdf" />
                        <dx:ListEditItem Value="1" Text="Export xls" />
                        <dx:ListEditItem Value="2" Text="Export csv" />
                        <dx:ListEditItem Value="3" Text="Export rtf" />
                    </Items>
                </dx:ASPxComboBox>
            </td>
            <td style="width:75px">
                <dx:ASPxButton ID="btnExport" runat="server" Text="Exporter" OnClick="btnExport_Click" Width="75px" >
                </dx:ASPxButton>
            </td>
            <td align="right">
                <asp:Label ID="lblView" runat="server" Text="Visning"></asp:Label>
                <asp:DropDownList ID="ddlView" runat="server" AutoPostBack="True" 
                    onselectedindexchanged="ddlView_SelectedIndexChanged">
                    <asp:ListItem Value="0">Ingen gruppering</asp:ListItem>
                    <asp:ListItem Value="1">Grupper efter By</asp:ListItem>
                </asp:DropDownList>
                &nbsp;
                <asp:Label ID="lblPageSize" runat="server" Text="Antal linjer pr side"></asp:Label>
                <asp:DropDownList ID="ddlPageSize" runat="server" AutoPostBack="true">
                    <asp:ListItem Value="10">10</asp:ListItem>
                    <asp:ListItem Value="25">25</asp:ListItem>
                    <asp:ListItem Value="50">50</asp:ListItem>
                    <asp:ListItem Value="100">100</asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
    </table>          
    <hr />
           
    <dx:ASPxGridView ID="gvGeographicalArea" runat="server" ClientInstanceName="gvGeographicalArea" Caption="Kørsels områder" 
        KeyFieldName="ServiceGeoAreaId" Width="100%" AutoGenerateColumns="False" EnableCallBacks="True" 
        OnRowInserting="gvGeographicalArea_RowInserting"
        OnRowUpdating="gvGeographicalArea_RowUpdating">
        <SettingsLoadingPanel Text="Henter&amp;hellip;" />
        <Settings ShowHeaderFilterButton="true" ShowGroupPanel="true" ShowFilterRow="True" />
        <SettingsPager AlwaysShowPager="True" PageSize="20" Position="TopAndBottom">
            <Summary 
                AllPagesText="Sider: {0} - {1} ({2} områder)" 
                Text="Side {0} af {1} ({2} områder)" />
        </SettingsPager>
        <SettingsText ConfirmDelete="Vil du slette område?" GroupPanel="Træk kolonne hertil for at gruppere efter den" HeaderFilterShowAll="Vis alle" />
        <SettingsBehavior ConfirmDelete="True" AllowGroup="true" AllowDragDrop="true" AllowFocusedRow="true" />
        <ClientSideEvents FocusedRowChanged="function(s, e) {
            if (typeof(gvGeographicalAreaZipCodeList) != 'undefined')
                gvGeographicalAreaZipCodeList.PerformCallback(s.GetFocusedRowIndex());
        }" 
        />
        <Columns>
            <dx:GridViewCommandColumn VisibleIndex="0">
                <EditButton Visible="True" Text="Rediger" />
                <NewButton Visible="True" Text="Opret" />
            </dx:GridViewCommandColumn>
            <dx:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0">
                    <HeaderTemplate>
                        <input type="checkbox" onclick="gvGeographicalArea.SelectAllRowsOnPage(this.checked);" style="vertical-align:middle;" title="Vælg/Fravælg alle linjer på siden"></input>
                    </HeaderTemplate>
                    <HeaderStyle Paddings-PaddingTop="1" Paddings-PaddingBottom="1" 
                        HorizontalAlign="Center">
                    <Paddings PaddingTop="1px" PaddingBottom="1px"></Paddings>
                    </HeaderStyle>
            </dx:GridViewCommandColumn>
            <dx:GridViewDataColumn FieldName="ServiceGeoAreaId" VisibleIndex="0" Caption="Geografisk Id">
                <EditFormSettings Visible="False" />
            </dx:GridViewDataColumn>
            <dx:GridViewDataComboBoxColumn Name="CountryDropdown" FieldName="CountryId" Caption="Land" VisibleIndex="1">
                <EditFormSettings VisibleIndex="0" />
            </dx:GridViewDataComboBoxColumn>
            <dx:GridViewDataColumn FieldName="Description" VisibleIndex="2" Caption="Navn/Beskrivelse">
                <EditFormSettings VisibleIndex="1" />
            </dx:GridViewDataColumn>
        </Columns>
        <SettingsEditing PopupEditFormModal="false" PopupEditFormHorizontalAlign="Center" PopupEditFormAllowResize="false" Mode="PopupEditForm" PopupEditFormWidth="600px" />
        <Templates>
            <EditForm>
                <dx:ASPxGridViewTemplateReplacement ID="Editors" ReplacementType="EditFormEditors" runat="server">
                </dx:ASPxGridViewTemplateReplacement>
                <div style="text-align: right; padding: 2px">
                    <dx:ASPxGridViewTemplateReplacement ID="UpdateButton" ReplacementType="EditFormUpdateButton" runat="server">
                    </dx:ASPxGridViewTemplateReplacement>
                    <dx:ASPxGridViewTemplateReplacement ID="CancelButton" ReplacementType="EditFormCancelButton" runat="server">
                    </dx:ASPxGridViewTemplateReplacement>
                </div>
            </EditForm>
        </Templates>            
    </dx:ASPxGridView>
    <hr />
    <dx:ASPxGridView ID="gvGeographicalAreaZipCodeList" runat="server" ClientInstanceName="gvGeographicalAreaZipCodeList" Width="100%" 
        KeyFieldName="AreaZipCodeId" AutoGenerateColumns="False" EnableCallBacks="True" 
        OnRowInserting="gvGeographicalAreaZipCodeList_RowInserting" 
        OnRowDeleting="gvGeographicalAreaZipCodeList_RowDeleting"
        OnCustomCallback="gvGeographicalAreaZipCodeList_CustomCallback">
        <SettingsLoadingPanel Text="Henter&amp;hellip;" />
        <Settings ShowHeaderFilterButton="true" ShowGroupPanel="true" ShowFilterRow="True" />
        <SettingsPager AlwaysShowPager="True" PageSize="20" Position="TopAndBottom">
            <Summary 
                AllPagesText="Sider: {0} - {1} ({2} postnr)" 
                Text="Side {0} af {1} ({2} postnr)" />
        </SettingsPager>
        <SettingsText ConfirmDelete="Vil du slette dette postnr?" />
        <SettingsBehavior ConfirmDelete="True" AllowGroup="true" AllowFocusedRow="true" AllowDragDrop="true" AllowSelectByRowClick="true" />
        <ClientSideEvents Init="function(s, e) {
	        s.PerformCallback(gvGeographicalArea.GetFocusedRowIndex());
        }" />

        <Columns>
            <dx:GridViewCommandColumn VisibleIndex="0">
                <NewButton Visible="True" Text="Opret" />
                <DeleteButton Visible="true" Text="Slet" />
            </dx:GridViewCommandColumn>
            <dx:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0">
                    <HeaderTemplate>
                        <input type="checkbox" onclick="gvGeographicalAreaZipCodeList.SelectAllRowsOnPage(this.checked);" style="vertical-align:middle;" title="Vælg/Fravælg alle linjer på siden"></input>
                    </HeaderTemplate>
                    <HeaderStyle Paddings-PaddingTop="1" Paddings-PaddingBottom="1" 
                        HorizontalAlign="Center">
                    <Paddings PaddingTop="1px" PaddingBottom="1px"></Paddings>
                    </HeaderStyle>
            </dx:GridViewCommandColumn>
            <dx:GridViewDataColumn FieldName="AreaZipCodeId" Visible="false" VisibleIndex="2" Caption="AreaZipCodeId">
            </dx:GridViewDataColumn>
            <dx:GridViewDataColumn FieldName="ServiceGeoAreaId" Visible="false" VisibleIndex="3" Caption="ServiceGeoAreaId">
            </dx:GridViewDataColumn>                    
            <dx:GridViewDataColumn FieldName="CountryId" Visible="false" VisibleIndex="4" Caption="CountryId">
            </dx:GridViewDataColumn>
            <dx:GridViewDataComboBoxColumn Name="ZipCodeDropdown" FieldName="ZipCode" Caption="Postnr" VisibleIndex="5">
                <EditFormSettings VisibleIndex="1" />
            </dx:GridViewDataComboBoxColumn>
            <dx:GridViewDataColumn FieldName="City" VisibleIndex="6" Caption="By">
                <EditFormSettings Visible="False"/>
            </dx:GridViewDataColumn>
            <dx:GridViewDataColumn FieldName="RegionId" Visible="false" VisibleIndex="7" Caption="RegionId">
            </dx:GridViewDataColumn>
            <dx:GridViewDataColumn FieldName="RegionName" VisibleIndex="8" Caption="Region">
                <EditFormSettings Visible="False"/>
            </dx:GridViewDataColumn>
        </Columns>
        <SettingsEditing PopupEditFormModal="false" PopupEditFormHorizontalAlign="Center" PopupEditFormAllowResize="false" Mode="PopupEditForm" PopupEditFormWidth="600px" />
        <Templates>
            <EditForm>
                <%--<div style="text-align: left; padding: 2px">
                    <h4>Tilføj postnr og by</h4>
                    <dx:ASPxComboBox ID="ddlZipCodeList" ClientInstanceName="ddlZipCodeList" IncrementalFilteringMode="StartsWith" 
                        DropDownWidth="300" DropDownStyle="DropDownList" runat="server" ValueField="ZipCode" TextFormatString="{0} {1}">
                        <Columns>
                            <dx:ListBoxColumn FieldName="ZipCode" Caption="Postnr" Width="100px" />
                            <dx:ListBoxColumn FieldName="City" Caption="By" Width="200px" />
                        </Columns>
                    </dx:ASPxComboBox>
                </div>--%>
                <div style="text-align: left; padding: 2px">
                    Opret postnr + by til liste
                </div>
                <dx:ASPxGridViewTemplateReplacement ID="Editors" ReplacementType="EditFormEditors" runat="server">
                </dx:ASPxGridViewTemplateReplacement>
                
                    
                <div style="text-align: right; padding: 2px">
                    <dx:ASPxGridViewTemplateReplacement ID="UpdateButton" ReplacementType="EditFormUpdateButton" runat="server">
                    </dx:ASPxGridViewTemplateReplacement>
                    <dx:ASPxGridViewTemplateReplacement ID="CancelButton" ReplacementType="EditFormCancelButton" runat="server">
                    </dx:ASPxGridViewTemplateReplacement>
                </div>
            </EditForm>
        </Templates>                                            
    </dx:ASPxGridView>

                                
    <dx:ASPxGridViewExporter ID="gvExport" runat="server" GridViewID="gvGeographicalAreaZipCodeList">
    </dx:ASPxGridViewExporter>
                
</asp:Content>
